/*
 * Copyright 2010 Piotr Buda
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package li.buda.cqflex.commandbus {

/**
 * The command handler is a special class that's sole purpose is to handle incomming
 * <code>Command</code> instances.
 * Command handlers are subscribed to <code>CommandBus</code>.
 * When a <code>Command</code> is published on the bus
 * and a corresponding command handler is registered for it, it is invoked.
 * @see li.buda.cqflex.commandbus.Command
 * @see li.buda.cqflex.commandbus.CommandBus
 * @author Piotr Buda
 * @since 0.1
 */
public interface CommandHandler {
    /**
     * This method is responsible for handling the incomming <code>Command</code>
     * that this command handler is registered for.
     * @param command an instance of <code>Command</code>
     * @returns 
     * @see li.buda.cqflex.commandbus.Command
     */
    function execute(command:Command):Object; //TODO: Change documentation to reflect return value
}
}